using System.Collections.Generic;
using System.Diagnostics;
using JT.WEB.Models;
using JT.WEB.Service;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Primitives;

namespace JT.WEB.Controllers
{
    public class HomeController : Controller
    {
        private readonly NewsService _newsService;
        private readonly BannerService _bannerService;
        public HomeController(NewsService newsService, BannerService bannerService)
        {
            _newsService = newsService;
            _bannerService = bannerService;

        }
        // GET: News
        public ActionResult Index()
        {

            //var vm = new IndexModel { BannerList = _bannerService.GetBannerList() };
            //vm.NewsClassifyList = _newsService.GetNewsClassifyList();
            //vm.NewsList = _newsService.GetNewsList(c => c.Id > 0, 5);
            //var a = new System.Linq.SystemCore_EnumerableDebugView<string>(
            //    ((Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http.HttpRequestHeaders)
            //        ((Microsoft.AspNetCore.Http.HttpRequest) this.Request).Headers).HeaderUserAgent).Items[0];
            //HttpContext.Request.Headers.H

            //var b = new List<string>();
            //StringValues agent;
            //var a = this.HttpContext.Request.Headers.TryGetValue("User-Agent",out agent);
            //foreach (var i in agent)
            //{
            //    b.Add(i);
            //}
            return View();
        }

        public IActionResult Privacy()
        {
            return View();
        }
        public IActionResult Disclaimer()
        {
            return View();
        }
        public ActionResult Details(int id)
        {
            NewsPublish.Model.Response.ResponseModel vm = _newsService.GetOneNews(id);
            return View(vm);
        }

        [ResponseCache(Duration = 0, Location = ResponseCacheLocation.None, NoStore = true)]
        public IActionResult Error()
        {
            return View(new ErrorViewModel { RequestId = Activity.Current?.Id ?? HttpContext.TraceIdentifier });
        }

    }
}